# Makefile for Dackel

SVNDEF := -D'SVN_REV="$(shell svnversion -n .)"'

CXX=g++
CXXFLAGS=-Wall $(SVNDEF) $(shell root-config --cflags)

CC=gcc
CFLAGS=-Wall $(SVNDEF) $(shell root-config --cflags)

# this must be adjusted to your installation
# e.g. INCLUDE=/home/perkeo/alex/sis1100/V1.0/sis3100_calls,
# for version 1.0 of the sis driver
LIBDIR=-L../sis1100/sis3100_calls -L../../../discriminator/pcicc32/lib
LIBS=-l_sis3100 -lcc32 -lz $(shell root-config --libs)
#LIBS=-l_sis3100 -lz $(shell root-config --libs)
INCLUDE=-I../src \
	-I../src/dkl \
	-I../src/hw \
	-I../sis1100/sis3100_calls \
	-I../sis1100/dev/pci \
	-I../../../discriminator/pcicc32/lib

SRCS =	../src/hw/VmeModule.cpp ../src/IOError.cpp ../src/ConfigReader.cpp \
	../src/teebuf.cpp ../src/stringutil.cpp ../src/inifile.cpp ../src/Profile.cpp \
	../src/dkl/DklHeader.cpp \
	../src/hw/vme_sis.cpp ../src/hw/Latch_SIS3600.cpp \
	../src/hw/StartStop.cpp \
	../src/hw/Counter_DL636G1.cpp ../src/hw/DigitalIO_DL636F.cpp ../src/hw/ADC_DL642A.cpp \
	../src/hw/TimeCounter_DL643A1.cpp \
	../src/hw/CAEN_module.cpp ../src/hw/QDC_V792.cpp ../src/hw/QDC_V965A.cpp \
	../src/hw/TDC_V767.cpp 	../src/hw/BufferedVMEReader.cpp ../src/hw/FIFO32DMAReader.cpp ../src/hw/TDC_V775N.cpp \
	../src/hw/Camac_CC32.cpp \
	../src/hw/CaenDiscriminator.cpp ../src/hw/Disc_C808.cpp ../src/hw/Disc_V812.cpp ../src/disc_lib.cpp \
	../src/LogicPool/LogicInterface.cpp ../src/LogicPool/LogicInterfaceVME.cpp \
	../src/LogicPool/LogicInterfaceUSB.cpp \
	../src/LogicPool/LogicPool.cpp ../src/LogicPool/LogicLevel.cpp \
	../src/LogicPool/LogicQDC.cpp ../src/LogicPool/LogicQDCBoard.cpp \
	../src/LogicPool/DFM.cpp

CSRCS= ../src/LogicPool/logicbox.c

OBJS=$(SRCS:.cpp=.o) $(CSRCS:.c=.o)
HDRS=$(SRCS:.cpp=.h) $(CSRCS:.c=.h)

# see "Managing Projects with GNU Make", Ch.2, P.16/17
# for explanation of $< and stuff
# (http://www.oreilly.com/catalog/make3/book/ch02.pdf)
%.o: %.cpp %.h
%.o: %.cpp %.h ../src/config.h
	$(CXX) $(INCLUDE) $(CXXFLAGS) -c $< -o $@
%.o: %.c %.h
	$(CC) $(INCLUDE) $(CFLAGS) -c $< -o $@
